﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using core_services.WCF.SalesReport;
using crm_dal.Objects;
using crm_library.DataAccess;

namespace crm_services.WCF.SalesReport
{
	[ServiceBehavior(Namespace = "http://crm_services/wcf/SalesReport/SalesReport.svc")]
	public class SalesReport : ISalesReport
	{
		#region ISalesReport Members

		public SalesReportResponse GenerateSalesReport(SalesReportFilter filter)
		{
			DBHandler.Init();

			var matches = Sale.GetAll().Where(sale => filter.Matches(sale));
			var response = new SalesReportResponse(matches.ToList());
			return response;
		}



		#endregion ISalesReport Members
	}
}
